package net.wwang.open.pojo;

import net.wwang.open.global.GlobalTipMsg;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;
import java.sql.Timestamp;

/**
 * @author WangWei
 * @date 2020/8/11
 */
@Data
@Entity
@Table(name = "document")
@NoArgsConstructor
@AllArgsConstructor
public class Document {
    @Id
    @Column(name = "menu_id")
    private String menuId;
    @NotBlank(message = GlobalTipMsg.DOCUMENT_NAME_NOT_EMPTY)
    @Size(max = 32,message = GlobalTipMsg.DOCUMENT_TITLE_TOO_LONG)
    @Pattern(regexp = "[^%&',;=?$\\x22]+",message = GlobalTipMsg.DOCUMENT_TITLE_EXISTS_SPECIAL_CHARACTERS)
    @Column(name = "title")
    private String title;
    @Column(name = "content")
    private String content;
    @Column(name = "create_time")
    private Timestamp createTime;
    @Column(name = "update_time")
    private Timestamp updateTime;
}
